/**************************************************************************
 * @doc PROTOCOL
 * @module PACKET.H | Header file for the Packet structure used in the
 *					  Protocol Engine
 *
 * Product     :   SoftPay 2000 (Global Payment Methodology).
 * <nl>Developer   :   SoftPay Development Team (I_SP2000).
 * <nl>Notes       :
 *
 * @head3 PROTOCOL Functions |
 * @index | PROTOCOL
 * @end
 *
 * Copyright (c) 1996-2000 by VeriFone Inc. All rights reserved.
 *
 * No part of this software may be used, stored, compiled, reproduced,
 * modified, transcribed, translated, transmitted, or transferred, in any form
 * or by any means whether electronic, mechanical, magnetic, optical,
 * or otherwise, without the express prior written permission of VeriFone, Inc.
 *
 * Revision History
 * ------------------------------------------------------------------------
 $Log: /SoftPay/SPK2SIM/Source/Include/packet.h $
 *
 * 4     3/06/00 1:16p Monique_b1
 * Added inBatch and inDebatch to packet structure.
 *
 * 3     12/14/99 4:04p Monique_b1
 * Removed inBatch from PACKET_OBJECT
 *
 * 2     10/04/99 2:24p Monique_b1
 * ------------------------------------------------------------------------
 ********************************************************************************/

#ifndef VSPACKET_H
#define VSPACKET_H

typedef struct packet_struct
{
	short  inType;

	short  inRecord;
	short inIndex;
	short inError;
	short inState;

	int inSendBuffSize;
	int inSendSize;
	unsigned char *pchSendBuff;

	int  inReceiveSize;
	int  inReceiveBuffSize;
	int	 inPacketCounter;               /* added for MDC to keep track of packets sent */
	long lnOfflineCounter;
	unsigned char *pchReceiveBuff;

	unsigned	fEOF				: 1;
	unsigned	fHoldLine			: 1;
	unsigned	fEOD				: 1;
	unsigned	fGenerateReversal	: 1;
	unsigned	fError				: 1;
	unsigned	fSkip				: 1;

	void *Data;
	void *Transaction;
	void *OriginalTransaction;
	void *FollowUpTransaction;

	int 	(*inInitialize)(void *);
	int		(*inPack)(void *);
	int		(*inUnpack)(void *);
	int		(*inAnalyse)(void *);
	int		(*inDeinitialize)(void *);
	int		(*inBatch)(void *);
	int		(*inDebatch)(void *);

} PACKET_OBJECT;

#ifndef VSPACKET_C
extern  void vdGetInterCharTO(int *pinIcto);
extern int inSendChar (char chSendChar);
extern int inRecvChar (int inTimeOut, char chChar);
extern int inRecvAnyChar (int inTimeOut, char *pchChar);
extern int inCheckLRC (char *stBuf, int inBufSize);
extern int inReadVisaPacket (void *psrCommPackage);
#else
void vdGetInterCharTO(int *pinIcto);
int inSendChar (char chSendChar);
int inRecvChar (int inTimeOut, char chChar);
int inRecvAnyChar (int inTimeOut, char *pchChar);
int inCheckLRC (char *stBuf, int inBufSize);
int inReadVisaPacket (PACKET_OBJECT *psrCommPackage);
#endif

#endif
